Skip to content

Export bounds fix#908

Open
rpgshooter wants to merge 4 commits intoTokisanGames:mainfrom
rpgshooter:export-bounds-fix
Open

Export bounds fix#908
rpgshooter wants to merge 4 commits intoTokisanGames:mainfrom
rpgshooter:export-bounds-fix

Conversation

@rpgshooter
Copy link
Copy Markdown
Contributor

Fixes #821

Adds bounded export functionality to export_image() and layered_to_image() with automatic 16k chunking support.

New ExportMode enum:

  • EXPORT_SLICED (default) - Exports full terrain, auto-chunked at 16k boundaries
  • EXPORT_PER_REGION - Exports each region as a separate file

Modified functions:

  • export_image(file_name, map_type, mode) - Added optional mode parameter
  • layered_to_image(map_type, bounds) - Added optional Rect2i bounds parameter

Output logging includes:

  • Filename
  • Size (pixels)
  • Position (pixel and world coordinates)

Usage

var data = terrain.get_data()

# Sliced export (default) - auto-chunks if terrain > 16k
data.export_image("res://terrain.exr", Terrain3DRegion.TYPE_HEIGHT)

# Per-region export - one file per region
data.export_image("res://terrain.exr", Terrain3DRegion.TYPE_HEIGHT, Terrain3DData.EXPORT_PER_REGION)

# Direct bounded export
var img = data.layered_to_image(Terrain3DRegion.TYPE_HEIGHT, Rect2i(0, 0, 8192, 8192))

File naming

  • Sliced: filename_00_00.exr, filename_01_00.exr, etc.
  • Per-region: filename_00_00.exr, filename_00-01.exr (handles negative coords)
  • Single chunk/region: no suffix added

Backward compatible

Default parameters maintain existing behavior - no changes required for existing code.

@rpgshooter
Copy link
Copy Markdown
Contributor Author

This is a draft and needs to be squashed, there shouldnt be 200+ additions, merge at same time as pr for c# stuff

@TokisanGames TokisanGames added bug Something isn't working enhancement New feature or request labels Dec 20, 2025
@TokisanGames TokisanGames added this to the 1.1 milestone Dec 20, 2025
@rpgshooter
Copy link
Copy Markdown
Contributor Author

Once 9c692a7 and 3eb9146, are squashed, should be good to merge, once all checks are good

@TokisanGames TokisanGames moved this from 1.1 to In Progress in Terrain3D Roadmap Dec 21, 2025
@rpgshooter rpgshooter marked this pull request as ready for review January 6, 2026 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Export bounds

2 participants